package com.example.cursor.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.cursor.entity.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ProductMapper extends BaseMapper<Product> {
    @Update("UPDATE product SET stock = stock - 1 WHERE id = #{id} AND stock > 0")
    int decreaseStock(Long id);
}